<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<script type="text/javascript">
var action = 'add';
var ptype   ='${bean.itemType}'||'1';
var punit   ='${bean.priceUnit}'||'万发';
var pdtid     ='${bean.code}';
var pdtcode ='${bean.code}';
var indepts = new Array();
var dtype = '${param.type}'||false;
<c:forEach items="${bean.providers}" var="d">
   indepts.push('${d.id}');
</c:forEach> 
if(dtype=='local'){
   indepts.push('${loginUser.department.id}');	
}
</script>
<div id="ptoolbar">
<button id="saveaction" class="btn btn-info">保存</button>
输入产品代码查询 <input id="pcode" />
</div>
<form>	
	<c:if test="${not empty bean.code}">	 
	  <script type="text/javascript">
	      action = 'update';
	  </script>
	</c:if>
	<table class="table table-bordered table-hover table-condensed table-striped">
		<caption>产品详细信息</caption>
		<tr >
			<th width="25%" scope="col">
				代码
			</th>
			<td  width="75%" scope="col">
				<input name="bean.code" type="text" value="${bean.code}" />
			</td>
		</tr>
		<tr >
			<th class="th">
				名称
			</th>
			<td >
				<input name="bean.name" type="text" value="${bean.name}" />
			</td>
		</tr>
		<tr >
			<th class="th">
				价格
			</th>
			<td >
				<input name="bean.price" type="text" value="${bean.price}"
				  onblur="judgeNumber(this)"
				 />
			</td>
		</tr>
		<tr >
			<th class="th">
				类型
			</th>
			<td >
			<%
				org.jackysoft.entity.ProductType[] ptypes  =  org.jackysoft.entity.ProductType.values();
					           	 	pageContext.setAttribute("ptypes", ptypes);
			%>	
			<select name="bean.itemType" id="ptype">
			   <c:forEach items="${ptypes}" var="pt">
            	 <option value="${pt}">${pt}</option>
          	   </c:forEach>
		    </select>
			</td>
		</tr>
		<tr >
			<th class="th">
				单位
			</th>
			<td >
				<select name="bean.priceUnit" id="punit">
					<option value="发">
						发
					</option>
					<option value="万发" selected>
						万发
					</option>
					<option value="公斤">
						公斤
					</option>
					<option value="米">
						米
					</option>
				</select>
			</td>
		</tr>
		<tr>
		<td>所属部门</td>
		<td><button id="viewquota" type="button" bid="${bean.code}">查看定额</button><button type="button" id="delquota">删除定额</button></td>
		</tr>
		<tr>
		<td>
		<div id="deptId">
		  
		</div>
	    </td>
	    <td>	     
		<div id="quotas">
		   
		   <div id="uquotas" size="10"></div>
		   
		</div>
		<hr />
		<div id="newquota">
		   <ul>
		      <li>产品:<input id="pcode2" /></li>
		      <li>定额:<input id="consume" onblur="judgeNumber(this)" value="1" />	</li>
		      <li><button type="button" id="quotabtn">添加</button>  </li>
		   </ul>		    
		</div>
		</td>
		</tr>
	</table>	
</form>
<link href="css/apps/product/product.css" type="text/css" rel="stylesheet" />
<script language="javascript" src="scripts/apps/product/product.js"></script>
